package com.work.vo.main;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.work.utils.BigDecimalSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.Func;

import java.math.BigDecimal;

/**
 * 货物库存汇总统计-货场详情VO
 *
 * @author ：dujianyu
 * @since ：Created in 2024/7/8 8:40
 */
@Data
public class StorageByPositionDetailVO {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "sbsID",notes = "")
    private Long id ;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "舱单ID",notes = "")
    private Long transportBillId ;

    @ApiModelProperty(value = "船名")
    private String shipNameZh;

    @ApiModelProperty(value = "航次")
    private String voyage;

    @ApiModelProperty(value = "单号")
    private String billNo;

    @ApiModelProperty(value = "货主")
    private String cargoOwnerName;

    @ApiModelProperty(value = "货代")
    private String cargoAgentName;

    @ApiModelProperty(value = "进出口")
    private String iE;

    @ApiModelProperty(value = "进出口")
    private String ieName;

    public String getIeName() {
        switch (iE) {
            case "E":
                return "出口";
            case "I":
                return "进口";
            case "CZ":
                return "存栈";
            default:
                return "";
        }
    }

    @ApiModelProperty(value = "货名")
    private String billCargoTypeName;

    @ApiModelProperty(value = "件数")
    private Integer piece;

    @JsonSerialize(using = BigDecimalSerializer.class)
    @ApiModelProperty(value = "吨数")
    private BigDecimal ton;

    @ApiModelProperty(value = "件吨")
    private String pieceTonInfo;

    public String getPieceTonInfo() {
        if (Func.isNull(piece) || Func.isNull(ton)) {
            return "";
        }
        return piece + "/" + ton.stripTrailingZeros().toPlainString();
    }

    @ApiModelProperty(value = "货位")
    private String spot;

}
